<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    {:token()}
    <input type="hidden" name="row[id]" value="{$row.id}">
    <div class="form-group">
        <label for="c-traffic" class="control-label col-xs-12 col-sm-2"><span style="color: red;font-size: 15px">*</span>{:__('交通（治疗）')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-traffic" class="form-control" data-rule="required" name="row[traffic]" oninput="checkmoney()" type="text" value="{$row.traffic|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label for="c-stay" class="control-label col-xs-12 col-sm-2"><span style="color: red;font-size: 15px">*</span>{:__('住宿（治疗）')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-stay" class="form-control" data-rule="required" name="row[stay]" oninput="checkmoney()" type="text" value="{$row.stay|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label for="c-repast" class="control-label col-xs-12 col-sm-2"><span style="color: red;font-size: 15px">*</span>{:__('餐饮（治疗）')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-repast" class="form-control" data-rule="required" name="row[repast]" oninput="checkmoney()" type="text" value="{$row.repast|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label for="c-traffics" class="control-label col-xs-12 col-sm-2"><span style="color: red;font-size: 15px">*</span>{:__('交通（开发维护）')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-traffics" class="form-control" data-rule="required" name="row[traffics]" oninput="checkmoney()" type="text" value="{$row.traffics|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label for="c-stays" class="control-label col-xs-12 col-sm-2"><span style="color: red;font-size: 15px">*</span>{:__('住宿（开发维护）')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-stays" class="form-control" data-rule="required" name="row[stays]" oninput="checkmoney()" type="text" value="{$row.stays|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label for="c-repasts" class="control-label col-xs-12 col-sm-2"><span style="color: red;font-size: 15px">*</span>{:__('餐饮（开发维护）')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-repasts" class="form-control" data-rule="required" name="row[repasts]" oninput="checkmoney()" type="text" value="{$row.repasts|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label for="c-discounted" class="control-label col-xs-12 col-sm-2"><span style="color: red;font-size: 15px">*</span>{:__('折扣费')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-discounted" class="form-control" data-rule="required" name="row[discounted]" oninput="checkmoney()" type="text" value="{$row.discounted|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label for="c-royalties" class="control-label col-xs-12 col-sm-2"><span style="color: red;font-size: 15px">*</span>{:__('提成费')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-royalties" class="form-control" data-rule="required" name="row[royalties]" oninput="checkmoney()" type="text" value="{$row.royalties|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label for="c-commission" class="control-label col-xs-12 col-sm-2"><span style="color: red;font-size: 15px">*</span>{:__('代理费')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-commission" class="form-control" data-rule="required" name="row[commission]" oninput="checkmoney()" type="text" value="{$row.commission|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label for="c-totals" class="control-label col-xs-12 col-sm-2">{:__('合计')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-totals" class="form-control" readonly="readonly" name="row[totals]" type="text" value="{$row.totals|htmlentities}">
        </div>
    </div>


    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
<script src="/assets/img/jquery-3.4.1.min.js"></script>
<script>

    function checkmoney(){
        var traffic = $("#c-traffic").val();
        var stay = $("#c-stay").val();
        var repast = $("#c-repast").val();
        var traffics = $("#c-repasts").val();
        var stays = $("#c-stays").val();
        var repasts = $("#c-repasts").val();
        var discounted = $("#c-discounted").val();
        var royalties = $("#c-royalties").val();
        var commission = $("#c-commission").val();

        var totals = parseFloat(traffic) + parseFloat(stay) + parseFloat(repast) + parseFloat(traffics) + parseFloat(stays) + parseFloat(repasts) + parseFloat(discounted) + parseFloat(royalties) + parseFloat(commission);
        $("#c-totals").val(totals);
    }
</script>
